package com.pushmsg.wappush;

public class WapPushWspHdr
{
	final private byte pushid = 0x01;
	final private byte pdutype = 0x06;
	final private byte hdrlen = 0x09;
	final private byte contenttype = (byte)0xAE;
	final private byte charset = (byte)0x81;
	final private byte csval = (byte)0xEA;
	final private byte appid = (byte)0xAF;
	final private byte appval = (byte)0x82;
	final private byte pushflag = (byte)0xB4;
	final private byte pfval = (byte)0x84;
	final private byte contentlen = (byte)0x8D;
	private byte clval;
	private byte[] data = new byte[12];

	public WapPushWspHdr(byte bodylen)
	{
		clval = (byte)(0x80|bodylen);
	}

	protected void setContentLen(byte len)
	{
		clval = (byte)(clval|len);
	}

	protected byte[] getData()
	{
		byte[] data = new byte[12];

		data[0] = pushid;
		data[1] = pdutype;
		data[2] = hdrlen;
		data[3] = contenttype;
		data[4] = charset;
		data[5] = csval;
		data[6] = appid;
		data[7] = appval;
		data[8] = pushflag;
		data[9] = pfval;
		data[10] = contentlen;
		data[11] = clval;
		return data;
	}

	protected int getLength()
	{
		return data.length;
	}

}